const Router = require('koa-router')

const { register, snedEmail, login, getUserInfo } = require('../controller/user.controller')
const { userValidator, verifyUser, verifyEcode, verificationLogin } = require('../middleware/user.middleware')
const { auth } = require('../middleware/auth.middleware')
const router = new Router({ prefix: '/users' })
// 发送邮件
router.post('/sendEmail', snedEmail)
// 注册
router.post('/register', userValidator, verifyUser, verifyEcode, register)
// 登录
router.post('/login', userValidator, verificationLogin, login)
// 获取用户信息
router.get('/getUserInfo', auth, getUserInfo)
module.exports = router